package com.sdy.dcsb.mq.config;

import com.sdy.dcsb.biz.constants.MqConstants;
import com.sdy.dcsb.mq.consumer.DcsbMessageConsumer;
import com.sdy.mq.base.BaseMessageListener;
import com.sdy.mq.config.RocketMqConfig;
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ConsumerGroupConfig {

    @Autowired
    private RocketMqConfig rocketMqConfig;
    @Autowired
    private DcsbMessageConsumer dcsbMessageConsumer;

    @Bean
    public DefaultMQPushConsumer dcsbMessageListener() throws Exception {
        return rocketMqConfig.createConsumerGroup("consumer_group_dcsb_log",
                new BaseMessageListener(dcsbMessageConsumer),
                MqConstants.Topics.TOPIC_DCSB,
                "esb_atomlog || esb_atomlog_req_split || esb_atomlog_req || esb_log || esb_log_req || esb_log_req_split");
    }

}
